<template>
	<view class="wrap-home">
     	<!-- <navbar :title="title"></navbar> -->
		<index v-if="tabbarIdx==0" :msg="boolMsg" ref="index"></index>
		<live v-if="tabbarIdx==1"></live>
		<mall v-if="tabbarIdx==2"></mall>
		<moments v-if="tabbarIdx==3"></moments>
		<me v-if="tabbarIdx==4"></me>
		<!-- 底栏 -->
		<tabbar :index="tabbarIdx" @change="handleTabbar"></tabbar>
	</view>
</template>

<script>
	import index from "./index/index"
	import live from "./live/index"
	import mall from "./mall/index"
	import moments from "./moments/index"
	import me from "./me/index"
	import tabbar from "@/components/tabbar/tabbar.vue"
	import navbar from "@/components/navbar/navbar1.vue"
	import variables from "@/uni.scss"
	export default {
		components: {
			index, live, mall, moments, me, tabbar, navbar
		},
		data() {
			return {
				tabbarIdx: 0,
				variables: variables,
				boolMsg: false,
				guid: '',
			}
		},
		onLoad() {
			uni.hideHomeButton();
		},
		methods: {
			handleCancelScan() {
				this.tabbarIdx = 0;
			},
			// 底栏交互
			handleTabbar(idx, item) {
				console.log("this.variables=", this.variables)
				console.log(idx);

					this.tabbarIdx = idx;

					// if (idx == 0) {
					// 	uni.setNavigationBarTitle({
					// 		title: '首页'
					// 	})
					// } else if (idx == 1) {
					// 	uni.setNavigationBarTitle({
					// 		title: '直播视频'
					// 	})
					// } else {
					// 	uni.setNavigationBarTitle({
					// 		title: '商城'
					// 	})
					// }
					if (idx == 0) {
						uni.setNavigationBarTitle({
							title: '首页'
						})
						uni.setNavigationBarColor({
						    frontColor: '#000000',
						    backgroundColor: '#ffffff'
						})
						// this.title = "首页";
					} else if (idx == 1) {
						uni.setNavigationBarTitle({
								title: '直播视频'
						})
						uni.setNavigationBarColor({
							frontColor: '#000000',
						    backgroundColor: '#ffffff'
						})
						// this.title = "直播视频";
					} else if (idx == 2) {
						uni.setNavigationBarTitle({
								title: '商城'
						})
						uni.setNavigationBarColor({
							    frontColor: '#000000',
						    backgroundColor: '#ffffff'
						})
						// this.title = "商城";
					} else if (idx == 3) {
						uni.setNavigationBarTitle({
							title: '发圈'
						})
						uni.setNavigationBarColor({
						    frontColor: '#000000',
						    backgroundColor: '#ffffff'
						})
						// this.title = "发圈";

					} else if (idx == 4) {
						uni.setNavigationBarTitle({
							title: '我的'
						})
						uni.setNavigationBarColor({
						    frontColor: '#000000',
						    backgroundColor: '#ffffff'
						})

						// this.title = "我的";

					}
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.banner{color: #fff;position: relative;
		.con{position: absolute;left: 0;top: 0;z-index: 9;width: 100%;height: 100%;}
	}
	.items{
		.item{background-color: #fff;width: calc(50% - 20rpx);
			&:active{background-color: #fbfbfb;}
		}
	}
</style>
